// MapEditorView.h : interface of the CMapEditorView class
//


#pragma once
#include "MapEditorDoc.h"
#include "GameMap.h"


class CMapEditorView : public CScrollView
{
protected: // create from serialization only
	CMapEditorView();
	DECLARE_DYNCREATE(CMapEditorView)

public:
	CMapEditorDoc* GetDocument() const;

public:
	void DocToClient(CRect& rect);
	virtual void OnDraw(CDC* pDC);
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
	virtual void OnInitialUpdate();

public:
	virtual ~CMapEditorView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:
	DECLARE_MESSAGE_MAP()
public:
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);

public:
	inline CGameMap& get_game_map() { return m_GameMap; }
	inline CSize& get_map_grid_count() { return m_GameMap.get_grid_count(); }

	void UpdateMapGridCount();
	void OnMDIActivate(BOOL bActivate);
	LRESULT OnGridItemValueChanged(CXTPPropertyGridItem* item);
	void OnTaskPanelItemClick(EGRIDINFO idx);
	void Serialize(CArchive& ar);
private:
	CGameMap m_GameMap;
public:
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
};

#ifndef _DEBUG  // debug version in MapEditorView.cpp
inline CMapEditorDoc* CMapEditorView::GetDocument() const
   { return reinterpret_cast<CMapEditorDoc*>(m_pDocument); }
#endif
